package com.yoso.definition;

import org.springframework.beans.factory.InitializingBean;

public class MyUser implements InitializingBean {
    private String name;
    private String desc;
 
    public MyUser() {
        System.out.println("2.无参构造,创建对象");
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        System.out.println("3.调用setName()方法");
        this.name = name;
    }
    public String getDesc() {
        return desc;
    }
    public void setDesc(String desc) {
        System.out.println("4.调用setDesc()方法");
        System.out.println("desc = " + desc);
        this.desc = desc;
    }
    @Override
    public String toString() {
        return "MyUser{" +
                "name='" + name + '\'' +
                ", desc='" + desc + '\'' +
                '}';
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("6.调用afterPropertiesSet() 初始化对象");
        this.name="韦小宝";
        this.desc="老子不干了";
    }
    //创建对象时指定initMethod
    public void initMethod(){
        System.out.println("7.调用initMethod()方法");
    }
}
